﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PhysicalExamination5.Model.DataMaintenance
{
    public class FuJiaFeiYongDataClass
    {
        public string strFuJiaFeiYongId { get; set; }
        [Required(ErrorMessage ="附加费用名称是必填项！")]
        public string strFuJiaFeiYongName { get; set; }
        public double dFuJiaFeYongJiaGe { get; set; }
        public string strFuJiaFeiYongXinZhi { get; set; }
        public string strShenQingDanId { get; set; }
        public string strFeiYongLeiBie { get; set; }
        private string _strShiFouTeShuHaoCai;
        public string strShiFouTeShuHaoCai
        {
            get
            {
                return string.IsNullOrEmpty(_strShiFouTeShuHaoCai) ? "否" : _strShiFouTeShuHaoCai;
            }
            set
            {
                _strShiFouTeShuHaoCai = value;
            }
        }
        private string _strShiFouGuaGouJianYan;
        public string strShiFouGuaGouJianYan
        {
            get
            {
                return string.IsNullOrEmpty(_strShiFouGuaGouJianYan) ? "否" : _strShiFouGuaGouJianYan;
            }
            set
            {
                _strShiFouGuaGouJianYan = value;
            }
        }
        public int iShuLiang { get; set; }
        public string? strBeiZhu1 { get; set; }
        public string? strBeiZhu2 { get; set; }
        public bool Validate(string strType,out string strFanHuiZhi)
        {
            bool isSuccess = true;
            strFanHuiZhi = "";
            List<string> Message = new List<string>();
            if (dFuJiaFeYongJiaGe <= 0)
            {
                Message.Add("附加费用价格小于等于0！");
            }
            if (iShuLiang <= 0)
            {
                Message.Add("数量小于等于0！");
            }
            if (strType=="Update")
            {
                if (string.IsNullOrEmpty(strFuJiaFeiYongId))
                {
                    Message.Add("附加费用ID是必填项！");
                }
            }
            if (Message.Count > 0)
            {
                isSuccess = false;
                strFanHuiZhi = string.Join("、", Message);
            }
            return isSuccess;
        }
    }
    public class FuJiaFeiYongDeleteClass
    {
        [Required(ErrorMessage = "附加费用ID是必填项！")]
        public string strFuJiaFeiYongId { get; set; }
    }
}
